package com.macro.mall.model;

import cn.hutool.json.JSONObject;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * cur_course_base实体类
 *
 * @author gaodx
 *
 */
@Data
public class CurCourseBase extends PageInfo implements Serializable{
	/**主键*/
    @ApiModelProperty(value = "主键")
	private Long id; 
	/**课程名称*/
    @ApiModelProperty(value = "课程名称")
	private String courseName; 
	/**课程类型*/
    @ApiModelProperty(value = "课程类型")
	private Long courseType; 
	/**课程讲师*/
    @ApiModelProperty(value = "课程讲师")
	private String teacher; 
	/**课程讲师*/
    @ApiModelProperty(value = "课程讲师描述")
	private String teacherDesc;
	/**课程讲师*/
    @ApiModelProperty(value = "课程讲师头像")
	private String teacherImg;
	/**课程简介*/
    @ApiModelProperty(value = "课程简介")
	private String courseDesc; 
	/**更新频率*/
    @ApiModelProperty(value = "更新频率")
	private String frequency; 
	/**课程封面*/
    @ApiModelProperty(value = "课程封面")
	private String coursePic; 
	/**状态*/
    @ApiModelProperty(value = "状态")
	private Integer status; 
	/**顺序*/
    @ApiModelProperty(value = "顺序")
	private Integer sort; 
	/**价格类型*/
    @ApiModelProperty(value = "价格类型")
	private Integer priceType; 
	/**标准价格*/
    @ApiModelProperty(value = "标准价格")
	private Double price; 
	/**归属部门*/
    @ApiModelProperty(value = "归属部门")
	private Long deptId; 
	/**创建时间*/
    @ApiModelProperty(value = "创建时间")
	private Date createTime; 
	/**创建人*/
    @ApiModelProperty(value = "创建人")
	private String createBy;
	/**更新时间*/
    @ApiModelProperty(value = "更新时间")
	private Date updateTime; 
	/**更新人*/
    @ApiModelProperty(value = "更新人")
	private String updateBy; 
	/**视频数量*/
    @ApiModelProperty(value = "视频数量")
	private Integer videoCount;
    /**
     * 业务范围
     */
    @ApiModelProperty(value = "业务范围")
    private List<String> deptRangeList;

	/**
	 * 实例化
	 */
	public CurCourseBase() {
		super();
	}
	/**
	 * 实例化
	 * 
	 * @param obj
	 */

	public CurCourseBase(JSONObject obj) {
		this();
		if (obj.get("id") instanceof Number) {
			this.setId(((Number) obj.get("id")).longValue());
		}
		if (obj.get("courseName") instanceof String) {
			this.setCourseName((String) obj.get("courseName"));
		}
		if (obj.get("courseType") instanceof Number) {
			this.setCourseType(((Number) obj.get("courseType")).longValue());
		}
		if (obj.get("teacher") instanceof String) {
			this.setTeacher((String) obj.get("teacher"));
		}
		if (obj.get("courseDesc") instanceof String) {
			this.setCourseDesc((String) obj.get("courseDesc"));
		}
		if (obj.get("frequency") instanceof String) {
			this.setFrequency((String) obj.get("frequency"));
		}
		if (obj.get("coursePic") instanceof String) {
			this.setCoursePic((String) obj.get("coursePic"));
		}
		if (obj.get("status") instanceof Number) {
			this.setStatus(((Number) obj.get("status")).intValue());
		}
		if (obj.get("sort") instanceof Number) {
			this.setSort(((Number) obj.get("sort")).intValue());
		}
		if (obj.get("priceType") instanceof Number) {
			this.setPriceType(((Number) obj.get("priceType")).intValue());
		}
		if (obj.get("price") instanceof Number) {
			this.setPrice(((Number) obj.get("price")).doubleValue());
		}
		if (obj.get("deptId") instanceof Number) {
			this.setDeptId(((Number) obj.get("deptId")).longValue());
		}
		this.setCreateTime((Date) obj.get("createTime"));
		if (obj.get("createBy") instanceof String) {
			this.setCreateBy((String) obj.get("createBy"));
		}
		this.setUpdateTime((Date) obj.get("updateTime"));
		if (obj.get("updateBy") instanceof String) {
			this.setUpdateBy((String) obj.get("updateBy"));
		}
		if (obj.get("videoCount") instanceof Number) {
			this.setVideoCount(((Number) obj.get("videoCount")).intValue());
		}
	}
	
	/**
	 * 将当前对象转换为JsonObject
	 * 
	 * @return
	 */
	public JSONObject toJson() {
		JSONObject result = new JSONObject();
		if (this.getId() != null) {
			result.put("id",this.getId());
		}
		if (this.getCourseName() != null) {
			result.put("courseName",this.getCourseName());
		}
		if (this.getCourseType() != null) {
			result.put("courseType",this.getCourseType());
		}
		if (this.getTeacher() != null) {
			result.put("teacher",this.getTeacher());
		}
		if (this.getCourseDesc() != null) {
			result.put("courseDesc",this.getCourseDesc());
		}
		if (this.getFrequency() != null) {
			result.put("frequency",this.getFrequency());
		}
		if (this.getCoursePic() != null) {
			result.put("coursePic",this.getCoursePic());
		}
		if (this.getStatus() != null) {
			result.put("status",this.getStatus());
		}
		if (this.getSort() != null) {
			result.put("sort",this.getSort());
		}
		if (this.getPriceType() != null) {
			result.put("priceType",this.getPriceType());
		}
		if (this.getPrice() != null) {
			result.put("price",this.getPrice());
		}
		if (this.getDeptId() != null) {
			result.put("deptId",this.getDeptId());
		}
		if (this.getCreateTime() != null) {
			result.put("createTime",this.getCreateTime());
		}
		if (this.getCreateBy() != null) {
			result.put("createBy",this.getCreateBy());
		}
		if (this.getUpdateTime() != null) {
			result.put("updateTime",this.getUpdateTime());
		}
		if (this.getUpdateBy() != null) {
			result.put("updateBy",this.getUpdateBy());
		}
		if (this.getVideoCount() != null) {
			result.put("videoCount",this.getVideoCount());
		}
		return result;
	}


	@Override
	public String toString() {
		return "CurCourseBase [id=" + id + " , courseName=" + courseName + " , courseType=" + courseType + " , teacher=" + teacher + " , courseDesc=" + courseDesc + " , frequency=" + frequency + " , coursePic=" + coursePic + " , status=" + status + " , sort=" + sort + " , priceType=" + priceType + " , price=" + price + " , deptId=" + deptId + " , createTime=" + createTime + " , createBy=" + createBy + " , updateTime=" + updateTime + " , updateBy=" + updateBy + " , videoCount=" + videoCount + "  ]";
	
	}
	
	
}
